#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int res=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){res=(res<<1)+(res<<3)+(c^48);c=getchar();}
	return res*f;
}
void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
struct node
{
	int nxt,to,id;
}e[100005<<1];
int head[100005],cnt_edge;
void add_edge(int u,int v,int w)
{
	e[++cnt_edge].to=v;
	e[cnt_edge].id=w;
	e[cnt_edge].nxt=head[u];
	head[u]=cnt_edge;
}
int n,x,a,b;
int f[11][2][1<<10];
void dfs(int u,int st,int s,int op,vector<int>&p,vector<int>&nxt)
{
	if((!op&&st>a)||(op&&st>b)) return;
	if(!op&&st==a) p.push_back(u),nxt.push_back(s);
	if(op&&st<=b) p.push_back(u),nxt.push_back(s);
	for(int i=head[u];i;i=e[i].nxt)
	{
		int v=e[i].to,id=e[i].id;
		if(op==1) dfs(v,st+1,s|(1<<id-1),op,p,nxt);
		else if(!(s&(1<<id-1))) dfs(v,st+1,s|(1<<id-1),op,p,nxt);
	}
}
int dp(int u,int op,int s)
{
	if(f[u][op][s]) return f[u][op][s];
	vector<int>p,nxt;
	if(!op)
	{
		dfs(u,0,s,0,p,nxt);
		if(!p.size())
		{
			dfs(u,0,s,2,p,nxt);
			f[u][op][s]=1e9;
			for(int v:p) f[u][op][s]=min(f[u][op][s],v);
		}
		else for(int i=0;i<p.size();i++) f[u][op][s]=max(f[u][op][s],dp(p[i],op^1,nxt[i]));
	}
	else
	{
		dfs(u,0,s,1,p,nxt);
		f[u][op][s]=1e9;
		for(int i=0;i<p.size();i++) f[u][op][s]=min(f[u][op][s],dp(p[i],op^1,nxt[i]));
	}
	return f[u][op][s];
}
int main()
{
	freopen("nim.in","r",stdin);
	freopen("nim.out","w",stdout);
	n=read(),x=read(),a=read(),b=read();
	for(int i=1;i<n;i++)
	{
		int u=read(),v=read();
		add_edge(u,v,i);add_edge(v,u,i);
	}
	if(n<=10) write(dp(x,0,0));
	else write(1);
	return 0;
}
